import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    bui: false,
    design: false,
    loadState: false,
    allListData: false,
    filePath: 'static/theme/',
    calendar: {
      begin: [],
      end: [],
      switch: false
    },
    themeIndex: 3,
    themeColors: {
      main: '',
      light: '',
      bold: '',
      heavy: ''
    },
    themesCloud: ['theme_0', 'theme_1', 'theme_2', 'theme_3'],
    themes: [{
        title: "Christmas",
        colors: {
          main: "233,144,88",
          light: "255,210,182",
          bold: "172,68,42",
          heavy: "111,33,39"
        }
      },
      {
        title: "2019",
        colors: {
          main: "",
          light: "",
          bold: "",
          heavy: ""
        }
      },
      {
        title: "20192",
        colors: {
          main: "",
          light: "",
          bold: "",
          heavy: ""
        }
      },
      {
        title: "snow",
        colors: {
          main: "",
          light: "",
          bold: "",
          heavy: ""
        }
      }
    ]
  },
  mutations: {
    upload(state, {
      prope,
      data
    }) {
      if (prope.split('.').length == 1) state[prope.split('.')[0]] = data;
      if (prope.split('.').length == 2) state[prope.split('.')[0]][prope.split('.')[1]] = data;
      if (prope.split('.').length == 3) state[prope.split('.')[0]][prope.split('.')[1]][prope.split('.')[2]] = data;
      if (prope.split('.').length == 4) state[prope.split('.')[0]][prope.split('.')[1]][prope.split('.')[2]][prope.split('.')[3]] = data;
      if (prope.split('.').length == 5) state[prope.split('.')[0]][prope.split('.')[1]][prope.split('.')[2]][prope.split('.')[3]][prope.split('.')[4]] = data;
    }
  },
  actions: {}
});